<!DOCTYPE html>
<html>
    <head>
        <title>AGM销售防伪码选择页</title>
        <link rel="stylesheet" href="/static/weui.min.css">
        <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
        <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <style>
            .page, body{background-color: #fbf9fe}
            .page_title{color:#225fba}
            .hd{text-align:center}
            .bd{padding: 10px;}
        </style>
    </head>
    <body>
        <div class="hd">
            <h1 class="page_title">AGM销售防伪中转</h1> 
        </div>
        <div class="bd">
            <a class="weui_btn weui_btn_primary">跳转到销售页面</a>
            <a class="weui_btn weui_btn_default">跳转到官方页面</a>
            <div class="weui_cells weui_cells_form">
                <div class="weui_cell weui_cell_switch">
                    <div class="weui_cell_hd weui_cell_primary">两周内不再提示</div>
                    <div class="weui_cell_ft">
                        <input class="weui_switch" type="checkbox">
                    </div>
                </div>
            </div>            
        </div>
    </body>    
    <script>
        $('.weui_btn_primary').click(function(){
            setdirectcookie('sellpage')
            location.href = 'sellhome' + location.search
        })
        $('.weui_btn_default').click(function(){
            setdirectcookie('agmpage')
            if($('.weui_switch')[0].checked){
                location.href = 'fwquery' + location.search
            }else{
                if(location.search!=""){
                location.href = "fwquery" + location.search + '&direct=1'}else{
                location.href = "fwquery?direct=1"
                }
            }
        })        
        setdirectcookie = function(direct){
            if($('.weui_switch')[0].checked){
                var d = new Date();
                d.setTime(d.getTime() + (14*24*60*60*1000));
                var expires = "expires="+d.toUTCString();
                document.cookie = "fwcodedirect="+direct+"; " + expires;
            }else{
                document.cookie = "fwcodedirect=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
            }
        }
    </script>
<html>